<%--
 *  File:    AgreementModel.jsp
 *  @Author: yuan
 *  Date:    1/20/2016 13:45
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%@ page import="com.oval.foundation.DefaultParams" %>

<%
  	Category cat = Category.getInstance("jsp.AgreementModel");
  	//init param
  	String strTableName = "v_agreementmodel";
  	String strModuleName = "CRM";
    String privilegeCode = "11208";
    String contextPath = request.getContextPath();
%>
<%
  	HashMap userInfo = (HashMap)session.getAttribute("userinfo");

%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>

<head>
<title>AgreementModel</title>
<PageFlow:CheckPageFlow pageName="p_agreementmodel"/>

<%
Vector totalsummary = (Vector) pageContext.getAttribute("totalsummary");
if (totalsummary == null)
    totalsummary = new Vector();
%>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/keyFunction.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(frm,actionvalue,orderbyname);
  editform.action = "AgreementModel.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}

function clickRow(id){
  document.frm.zmylagreementmodelid.value = id;
}

function page_delete(){

	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE")%>") ) 
	    return;
	    var frm = document.frm;
	    frm.actionname.value = "delpic";
		frm.target = "_self";
		isRunning = true;
		frm.submit();
}

function page_download()
{
	var frm = document.frm;
	frm.actionname.value="download";
	frm.target = "_self";
	isRunning = true;
	frm.submit();
}

function page_upload(){
	var url = "AgreementModelUpload.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>";
	self.location.href = url;
}

</script>
</head>
<body>

	<%--------------------------------------  hidden form variant   --%>
	<form name="frm" method="post" action="../../Dispatcher">
	<%@ include file="/inc/PageLocation.inc" %>

    <input type="hidden" name="pagename" value="p_agreementmodel">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>"> 
    <input type="hidden" name="userid" value="<%=JspHelper.filterNull(userInfo.get("userid"))%>">
    
    <input type="hidden" name="uploadpath" value="Y:/"/>
    
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr> 
	    <td> 
	      <table width="100%" border="0" cellspacing="0">
	        <tr> 
	          <td class="summary_top" colspan="3" ></td>
	        </tr>
	        <tr>
	          <td>    
	            <table border="0" cellspacing="0">    
	            <%@ include file="/inc/SummarySearch.inc" %>  
	            </table>
	          </td>
	        </tr>
	      </table>
	    </td>
    </tr>
		<tr>
			<td>
				<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
					<tr class="deepblue-left">
						<td width="5%" class="title_center">&nbsp;</td>
						<td width="50%" class="title_center"><a href="javascript:page_summary('orderby','picturename')"><%= label.getLabelName("L_TemplateName") %></a> </td>
						<td width="45%" class="title_center"><a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_UploadDate") %></a> </td>
					</tr>
					<%
						int i=0; 
						Integer idx = new Integer(-1);
                        boolean bHasChecked = false;
                        String strClassType = "";
                        String strChecked = "";
                        Integer nDefaultId = null;
                    %>
					<logic:iterate id="onerow" collection="<%=totalsummary%>" >
              
            <%
					HashMap tempMap = (HashMap)pageContext.getAttribute("onerow");
					if(i%2 == 1){
						strClassType = "td-listrom";
					}else{
						strClassType = "none";
					}
					if(!bHasChecked)
		            {
		              nDefaultId = (Integer)((HashMap)pageContext.getAttribute("onerow")).get("zmylagreementmodelid");
		              
		              bHasChecked = true;
		              strChecked = "Checked";
		            }
		            else
		            {
		              strChecked = "";
		            }
					i++; 
			%>
			<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="radiotrue('zmylagreementmodelid<%=JspHelper.filterNull( i )%>');
			    javascript:clickRow('<oval:write name="onerow" property="zmylagreementmodelid" />');"
          		class="<%=JspHelper.filterNull( strClassType )%>"> 
          		<td> 
              		<input <%=JspHelper.filterNull( strChecked )%> id="zmylagreementmodelid<%=JspHelper.filterNull( i )%>" type="radio" name="order" value="<oval:write name="onerow" property="zmylagreementmodelid"/>" class="normalradio"/>
            	</td>
				
						<td>
						    <custom:write name="onerow" property="picturename" nbsp="true" />
						     
						</td>
						<td>
						    <custom:write name="onerow" property="createdate" nbsp="true" />
						     
						</td>
						
					</tr>
					</logic:iterate>
					 <input type="hidden" name="zmylagreementmodelid" value="<%=JspHelper.filterNull( nDefaultId )%>">
					<%@ include file="/inc/SummaryAction.inc"%>
				</table>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td class="summary_top" ></td>
					</tr>
					<tr>
						<td class="td_center">
							<a onclick="page_upload();"><custom:button type="1" label="L_Upload" imgsrc="new.gif" border="0" style="width:60" privilegeCode="11209" /></a>
							&nbsp;&nbsp;&nbsp;
							<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete_btn.gif" border="0" style="width:60" privilegeCode="11210" /></a>
							&nbsp;&nbsp;&nbsp;
							<a onclick="page_download()"><custom:button type="1" label="L_Download" imgsrc="new.gif" border="0" style="width:60" privilegeCode="11211" /></a>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	
</form>
</body>


</html>


